#include "soldier.h"

Soldier::Soldier(MD2Model *opponentModel, MD2Model *weaponModel) : Opponent(opponentModel, weaponModel)
{
	bloodingAnimationSpeed = 0.05;
	stayingAnimationSpeed = 0.05;
	attackingAnimationSpeed = 0.03;
	walkingAnimationSpeed = 0.05;
	dyingAnimationSpeed = 0.05;

	pos1x = 1;
	pos1y = 0.22;
	pos1z = -5;

	pos2x = 6;
	pos2y = 0.22;
	pos2z = -5;

	walkingSpeed = 0.009;

	strcpy_s(hitFrame, strlen(hitFrame), "pain1");

	direction = 1;
	moves = true;
	isWalking = true;
	opponentModel->setAnimation("run");
	weaponModel->setAnimation("run");
}

void Soldier::draw()
{
	glPushMatrix();
		glTranslated(posx, posy, posz);
		
		glScalef(0.008, 0.008, 0.008);
		if (direction == 1)
			glRotated(180, 0, 1, 0);
		glRotated(180, 0, 1, 0);
		glRotated(-90, 1, 0, 0);
		
		if (opponentModel != NULL)
			opponentModel->draw();
		if (weaponModel != NULL)
			weaponModel->draw();
	glPopMatrix();
}